In image compression methods such as Motion Picture Experts Group (MPEG)-1, MPEG-2, MPEG-4 and H.264/MPEG-4 Advanced Video Coding (AVC), one picture is divided into macroblocks to encode an image. And, the respective macroblocks are encoded using inter prediction or intra prediction. Then, an optimal coding mode is selected in the bases of a data size of a macroblock to be encoded and distortion of an original macroblock, and the macroblock is encoded.
In the inter prediction, a motion estimation is used to eliminate temporal redundancy between consecutive pictures. The motion estimation coding is a method which encodes an image by estimating and compensating a motion of the current picture in the unit of block using one or more reference pictures.
In the motion estimation coding, the block most similar to the current block is searched within a predetermined search range for a reference picture using a predetermined estimation function. If the most similar block is searched, only residue between the current block and the most similar block in the reference picture is transmitted to raise a data compression ratio.
At this time, to decode the motion estimation coded current block, information for the motion vector indicating a position difference between the current block and the similar block in the reference picture. Therefore, it is required to insert encoded information for the motion vector into a bitstream when the current block is encoded. In this process, if the information for the motion vector is encoded and inserted as it is, a compression ratio of an image data is decreased because overhead is increased.
Therefore, in the inter prediction encoding, a motion vector of the current block is predicted using blocks adjacent to the current block, only a difference value between the generated motion vector predictor and the original motion vector is encoded and transmitted, and the information of the motion vector is also compressed.
In H.264, the motion vector predictor, which is a predictor of a motion vector of the current block, is determined as a median of mvA, mvB and mvC. As neighboring blocks are inclined to be similar each other, the motion vector of the current block is determined as a median of the motion vectors of the neighboring blocks.
But, if one or more motion vectors of the neighboring blocks are different from the motion of the current block, the median of the motion vectors of the neighboring blocks may be not an effective motion vector predictor for the current block. Also, a method of selecting a candidate for predicting a motion vector and of encoding or decoding the motion vector more effectively compared to the known motion prediction method is required when the motion of image is little or steady.